package com.example.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.project.vo.model.AuthUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface LoginMapper {

    @Select("select id, role ,user_name, phone, password , create_time from user where user_name = #{username}")
     List<AuthUser> selectLogin(String username);

    @Select("select password from user where id = #{id}")
    String getOldPassword(Long id);

    @Update("update user set password =#{newPassWord} where email =#{email} ")
    void changePasswordByEmail(String newPassWord, String email);

    @Update("update user set password =#{newPassWord} where id =#{id}")
    void changePasswordById(String newPassWord, Long id);
}
